package org.monster.app;

import java.util.logging.Level;
import java.util.logging.Logger;

/**
 * 应用工厂
 */
public class AppFactory {

    /**
     * 日志器
     */
    private static final Logger logger = Logger.getLogger(AppFactory.class.getName());

    /**
     * 获取实例
     *
     * @param className 类名
     * @return 应用
     * @throws ClassNotFoundException 没未找到异常
     */
    public static App getInstance(String className) {
        App webApp = null;
        try {
            webApp = (App) Class.forName(className).newInstance();
        } catch (InstantiationException
                | IllegalAccessException
                | ClassNotFoundException ex) {
            logger.log(Level.SEVERE, null, ex);
        }
        return webApp;
    }
}
